home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 11
/
FM Towns Free Software Collection 11.iso
/
t_os
/
game
/
pr
/
src
/
mmv2.02
< prev
next >
Wrap
Text File
|
1995-08-20
|
19KB
|
750 lines
/*===================================
Make polygon Map data
3D test version.
===================================*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <egb.h>
#include <filekh.h>
char EgbWork[EgbWorkSize];
#define MAPFILE "course02.pmd"
#define C32K(b,r,g) (0x01*(b)+0x020*(r)+0x400*(g))
#define C32B(col) ((col)%0x20)
#define C32R(col) (((col)/0x20)%0x20)
#define C32G(col) ((col)/0x400)
#define ROADCOL C32K(18,12,12)
#define EDCOL1 C32K(0,30,0)
#define EDCOL2 C32K(30,30,30)
#define EDGE 5
typedef struct {
short x,y,z;
} p3d;
typedef struct { /* Polygon データ */
p3d pt[4];
short type;
} poly;
typedef struct {
short px[4];
short py[4];
short pz;
p3d kv;
} rdata;
#define RMAX 1800
#define PMAX 6000
#define STEP 400
#define CSTEP 200
//#define MINSTEP 20
#define RDMAG 4/5
typedef struct {
short x,y,z;
short wl,wr;
short bank;
short stp;
} Road;
Road road[RMAX];
poly rdpol[RMAX];
rdata rddat[RMAX];
short polmax,pn,rd=0;
poly mapdata[PMAX];
short chk[20],chks,exTime[20];
// objects
poly mt[4];
poly stand[12];
poly gt[3];
poly pd[3];
poly cp[2];
poly cvp[5];
short step=STEP;
double cang=0; // current angle
short cx=0,cy=0,cz=0;
short cwl=0,cwr=0,cbank=0;
double pi=_PI;
int crd=0; // current road number
/*=======================================
subroutines for setting road[]
=======================================*/
void setR( short stp )
{
if( crd>=RMAX ) exit ;
road[crd].x = cx ;
road[crd].y = cy ;
road[crd].z = cz+150 ;
road[crd].wl = cwl ;
road[crd].wr = cwr ;
road[crd].bank = cbank ;
road[crd].stp = stp ;
// printf("<%d,%d,%d>\n",cx,cy,cz);
}
void
goStr( len, nz )
short len, nz ;
{
printf("go strait : %d[%d]\n",len,nz);
short clen=0;
short sx=cx,sy=cy,sz=cz;
int i,j=len/STEP+1 ;
for(i=1; i<=j; ++i)
{
clen = len*i/j ;
crd++ ;
cx = sx + clen*cos(cang) ;
cy = sy + clen*sin(cang) ;
cz = sz + (nz-sz)*clen/len ;
setR(len/j);
}
}
void
curveRt( r, nang, nz, nbank )
short r;
double nang;
short nz, nbank;
{
printf("curve Right : r=%d,nang=%f,nz=%d\n",r,nang,nz);
short ox,oy, sz=cz ;
short sbank=cbank ;
double sang=cang;
int i,j=r*(nang-sang)/CSTEP+1;
ox = cx - r*sin(cang) ;
oy = cy + r*cos(cang) ;
for(i=1; i<=j; ++i)
{
cang = sang+(nang-sang)*i/j ;
++crd ;
cx = ox + r*sin(cang) ;
cy = oy - r*cos(cang) ;
cz = sz + (nz-sz)*i/j ;
cbank = sbank + (nbank-sbank)*i/j ;
setR(r*(nang-sang)/j);
// if( r<=600 )
// setCvp( cx,cy,cz+500,cang );
}
cang = nang ;
cz = nz ;
cbank = nbank;
}
void
curveLf( r, nang, nz, nbank )
short r;
double nang;
short nz, nbank;
{
printf("curve Left : %d[%d]\n",r,nz);
short ox,oy, sz=cz ;
short sbank=cbank ;
double sang=cang;
int i,j=r*(sang-nang)/CSTEP+1;
nbank = -nbank ;
ox = cx + r*sin(cang) ;
oy = cy - r*cos(cang) ;
for(i=1; i<=j; ++i)
{
cang = sang+(nang-sang)*i/j ;
++crd ;
cx = ox - r*sin(cang) ;
cy = oy + r*cos(cang) ;
cz = sz + (nz-sz)*i/j ;
cbank = sbank + (nbank-sbank)*i/j ;
setR(r*(sang-nang)/j) ;
// if( r<=600 )
// setCvp( cx,cy,cz+500,cang+pi );
}
cang = nang ;
cz = nz ;
cbank = nbank;
}
/*====================
pol -> kvect
====================*/
p3d ortholize( p3d vec )
{
double l;
l = sqrt(vec.x*vec.x+vec.y*vec.y+vec.z*vec.z) ;
if(l==0) return vec;
vec.x = (double)vec.x*1000/l ;
vec.y = (double)vec.y*1000/l ;
vec.z = (double)vec.z*1000/l ;
return vec ;
}
p3d exterior( poly pol )
{
p3d kv;
kv.x = (pol.pt[1].y-pol.pt[0].y)*(pol.pt[3].z-pol.pt[0].z)/100
-(pol.pt[1].z-pol.pt[0].z)*(pol.pt[3].y-pol.pt[0].y)/100 ;
kv.y = (pol.pt[1].z-pol.pt[0].z)*(pol.pt[3].x-pol.pt[0].x)/100
-(pol.pt[1].x-pol.pt[0].x)*(pol.pt[3].z-pol.pt[0].z)/100 ;
kv.z = (pol.pt[1].x-pol.pt[0].x)*(pol.pt[3].y-pol.pt[0].y)/10
-(pol.pt[1].y-pol.pt[0].y)*(pol.pt[3].x-pol.pt[0].x)/10 ;
return ortholize( kv );
}
int inner( p3d a, p3d b )
{
int i ;
i = a.x*b.x ;
i+= a.y*b.y ;
i+= a.z*b.z ;
return i ;
}
/*==========================
超簡易レンダリング?
==========================*/
short colset( poly pol )
{
p3d ray ;
ray.x=1,ray.y=1,ray.z=2 ;
ray = ortholize( ray ) ;
p3d kv ;
kv = exterior( pol ) ;
int i;
i = _abs( inner(ray,kv) )/100 ; // 0 <= i <= 10000
i = ( 4000 + i*7/10 ) ; // 環境光 40%
int b,r,g;
b = C32B(pol.type) ;
r = C32R(pol.type) ;
g = C32G(pol.type) ;
b = ((b*i)/10000) ; b = _min(31,b) ;
r = ((r*i)/10000) ; r = _min(31,r) ;
g = ((g*i)/10000) ; g = _min(31,g) ;
return C32K(b,r,g);
}
/*=================================
road[] -> mapdata[],rddat[]
=================================*/
#define X(i) (road[i].x)
#define Y(i) (road[i].y)
#define Z(i) (road[i].z)
#define B(i) (road[i].bank)
#define L(i) (road[i].wl)
#define R(i) (road[i].wr)
void makeRdat()
{
p3d p[RMAX][4];
poly rdpol ;
short ax,ay,l;
short x,y,z;
int i,lz,j,a,b;
road[0] = road[crd];
road[crd+1] = road[1];
// スムージング
int smtlev = 3;
while(smtlev>=0)
{
smtlev--;
lz=road[crd-1].z ;
for(i=0; i<=crd; ++i)
{
a=road[i].stp;
b=road[i+1].stp;
j = ((lz*b+road[i+1].z*a)/(a+b)*1+road[i].z*1)/2 ;
lz = road[i].z ;
road[i].z = j;
}
road[crd+1] = road[1];
}
// 道幅変更(^^;)
for(i=0; i<=crd+1; ++i)
{
road[i].wr = road[i].wr*RDMAG ;
road[i].wl = road[i].wl*RDMAG ;
}
for(i=0; i<=crd; ++i)
{
ay = X(i+1) - X(i) ;
ax =-Y(i+1) + Y(i) ;
l = sqrt( ax*ax + ay*ay );
p[i][0].x = X(i) - ax* (L(i)+EDGE)/l ;
p[i][0].y = Y(i) - ay* (L(i)+EDGE)/l ;
p[i][0].z = Z(i) + (L(i)+EDGE)*sin((B(i)+20)*pi/1800)*10 ;
p[i][1].x = X(i) - ax* L(i)/l ;
p[i][1].y = Y(i) - ay* L(i)/l ;
p[i][1].z = Z(i) + L(i)*sin(B(i)*pi/1800)*10 ;
p[i][2].x = X(i) + ax* R(i)/l ;
p[i][2].y = Y(i) + ay* R(i)/l ;
p[i][2].z = Z(i) - R(i)*sin((B(i)+20)*pi/1800)*10 ;
p[i][3].x = X(i) + ax* (R(i)+EDGE)/l ;
p[i][3].y = Y(i) + ay* (R(i)+EDGE)/l ;
p[i][3].z = Z(i) - (R(i)+EDGE)*sin(B(i)*pi/1800)*10 ;
}
for(i=0; i<4; ++i)
p[crd+1][i] = p[crd][i];
for(i=0; i<crd; ++i)
{
mapdata[pn].pt[0] = p[i][0] ;
mapdata[pn].pt[1] = p[i+1][0] ;
mapdata[pn].pt[2] = p[i+1][1] ;
mapdata[pn].pt[3] = p[i][1] ;
mapdata[pn].type = (i%2==0 ? EDCOL1 : EDCOL2 ) ;
mapdata[pn].type = colset(mapdata[pn]);
++pn ;
mapdata[pn].pt[0] = p[i][1] ;
mapdata[pn].pt[1] = p[i+1][1] ;
mapdata[pn].pt[2] = p[i+1][2] ;
mapdata[pn].pt[3] = p[i][2] ;
mapdata[pn].type = ROADCOL ;
mapdata[pn].type = colset(mapdata[pn]);
++pn ;
mapdata[pn].pt[0] = p[i][2];
mapdata[pn].pt[1] = p[i+1][2];
mapdata[pn].pt[2] = p[i+1][3];
mapdata[pn].pt[3] = p[i][3];
mapdata[pn].type = (i%2==0 ? EDCOL1 : EDCOL2 ) ;
mapdata[pn].type = colset(mapdata[pn]);
++pn;
rdpol.pt[0] = p[i][1] ;
rdpol.pt[1] = p[i+1][1] ;
rdpol.pt[2] = p[i+1][2] ;
rdpol.pt[3] = p[i][2] ;
rddat[rd].px[0] = p[i][1].x ;
rddat[rd].py[0] = p[i][1].y ;
rddat[rd].px[1] = p[i+1][1].x ;
rddat[rd].py[1] = p[i+1][1].y ;
rddat[rd].px[2] = p[i+1][2].x ;
rddat[rd].py[2] = p[i+1][2].y ;
rddat[rd].px[3] = p[i][2].x ;
rddat[rd].py[3] = p[i][2].y ;
rddat[rd].pz = p[i][1].z ;
rddat[rd].kv = exterior( rdpol ) ;
rd++ ;
}
}
save_texdat( short sx, short sy, double sang )
{
short sangle;
int i,j,k;
sang = sang*500/pi;
sangle = sang;
sangle = (sangle+10000)%1000;
FILE *fp;
fp=fopen(MAPFILE,"wb");
if (fp==NULL) return 0;
putShort(sx,fp);
putShort(sy,fp);
putShort(sangle,fp);
putShort(polmax,fp);
for (i=0;i<polmax;i++){
for(j=0; j<4; ++j){
putShort(mapdata[i].pt[j].x,fp);
putShort(mapdata[i].pt[j].y,fp);
putShort(mapdata[i].pt[j].z,fp);
}
putShort(mapdata[i].type,fp);
}
putShort(rd,fp);
fwrite((char *)rddat, sizeof(rdata), rd, fp);
putShort(chks,fp);
fwrite((char *)chk, sizeof(short), chks, fp);
fwrite((char *)exTime, sizeof(short), chks, fp);
if (ferror(fp)){
puts("File write error!!");
return 0;
}
return 1;
}
void initGrp()
{
EGB_init( EgbWork, EgbWorkSize ); /* 初期化 */
EGB_resolution ( EgbWork, 0, 3 ); /* 32k(320*240) */
EGB_resolution ( EgbWork, 1, 3 ); /* 16 (640*480) */
EGB_displayPage( EgbWork, 1, 3 ); /* 表示ページの指定 */
EGB_writePage ( EgbWork, 0 );
EGB_writeMode ( EgbWork, 0 ); /*※描画モードの設定 */
EGB_paintMode ( EgbWork, 0x20 );
}
void putlmap()
{
int i, j;
char para[10];
struct {
unsigned short num;
short p[8];
} poly;
poly.num = 4;
EGB_paintMode( EgbWork, 0x02 );
for(i=0; i<=25000; i+=500)
{
EGB_color( EgbWork, 0, i%5000==0 ? 9 : 1 );
WORD(para+0) = 2;
WORD(para+2) = 0; WORD(para+4) = i*640/25000;//480
WORD(para+6) = 639; WORD(para+8) = i*640/25000;
EGB_connect( EgbWork, para );
WORD(para+4) = 0; WORD(para+2) = i*640/25000;
WORD(para+8) = 639; WORD(para+6) = i*640/25000;
EGB_connect( EgbWork, para );
}
EGB_paintMode( EgbWork, 0x02 );
for(i=0; i<polmax; ++i){
for(j=0; j<4; ++j){
poly.p[2*j ] = mapdata[i].pt[j].x *640/25000;
poly.p[2*j+1] = mapdata[i].pt[j].y *640/25000;
}
EGB_color( EgbWork, 2, 15 );
EGB_polygon( EgbWork, &poly );
}
}
void putPoly( pol, n, x,y,z, angle, dx,dy,dz, dcol )
poly *pol;
int n;
short x,y,z;
double angle;
int dx,dy,dz;
short dcol;
{
dz *=10;
int i,j;
for(i=0; i<n; ++i)
{
for(j=0; j<4; ++j)
{
mapdata[pn].pt[j].x = pol[i].pt[j].x*cos(angle)*dx -
pol[i].pt[j].y*sin(angle)*dy +x;
mapdata[pn].pt[j].y = pol[i].pt[j].x*sin(angle)*dx +
pol[i].pt[j].y*cos(angle)*dy +y;
mapdata[pn].pt[j].z = pol[i].pt[j].z*dz +z;
mapdata[pn].type = (pol[i].type)*dcol;
}
++pn;
}
}
// 以上 共通部分
void setPolData()
{
// Mountain ( 四角錐 )
mt[0].pt[0].x =0; mt[0].pt[0].y =1; mt[0].pt[0].z =0;
mt[0].pt[1].x =1; mt[0].pt[1].y =0; mt[0].pt[1].z =0;
mt[0].pt[2].x =0; mt[0].pt[2].y =0; mt[0].pt[2].z =1;
mt[0].pt[3].x =0; mt[0].pt[3].y =0; mt[0].pt[3].z =1;
mt[0].type = 25;
mt[1].pt[0].x =1; mt[1].pt[0].y =0; mt[1].pt[0].z =0;
mt[1].pt[1].x =0; mt[1].pt[1].y =-1; mt[1].pt[1].z =0;
mt[1].pt[2].x =0; mt[1].pt[2].y =0; mt[1].pt[2].z =1;
mt[1].pt[3].x =0; mt[1].pt[3].y =0; mt[1].pt[3].z =1;
mt[1].type = 28;
mt[2].pt[0].x =0; mt[2].pt[0].y =-1; mt[2].pt[0].z =0;
mt[2].pt[1].x =-1; mt[2].pt[1].y =0; mt[2].pt[1].z =0;
mt[2].pt[2].x =0; mt[2].pt[2].y =0; mt[2].pt[2].z =1;
mt[2].pt[3].x =0; mt[2].pt[3].y =0; mt[2].pt[3].z =1;
mt[2].type = 31;
mt[3].pt[0].x =-1; mt[3].pt[0].y =0; mt[3].pt[0].z =0;
mt[3].pt[1].x =0; mt[3].pt[1].y =1; mt[3].pt[1].z =0;
mt[3].pt[2].x =0; mt[3].pt[2].y =0; mt[3].pt[2].z =1;
mt[3].pt[3].x =0; mt[3].pt[3].y =0; mt[3].pt[3].z =1;
mt[3].type = 28;
// Stand
short i,j,n;
short scol[3][4]={
{ C32K(31,0,10),C32K(31,0,15),C32K(31,0,12),C32K(31,0,16) },
{ C32K(31,0,18),C32K(31,0,22),C32K(31,0,10),C32K(31,0,19) },
{ C32K(31,0,15),C32K(31,0,11),C32K(31,0,18),C32K(31,0,13) } };
for(i=0; i<4; ++i)
for(j=0; j<3; ++j){
n=i*3+j;
stand[n].pt[0].x =i; stand[n].pt[0].y =-j; stand[n].pt[0].z =j;
stand[n].pt[1].x =i+1; stand[n].pt[1].y =-j; stand[n].pt[1].z =j;
stand[n].pt[2].x =i+1; stand[n].pt[2].y=-j-1; stand[n].pt[2].z =j+1;
stand[n].pt[3].x =i; stand[n].pt[3].y=-j-1; stand[n].pt[3].z =j+1;
stand[n].type = scol[j][i];
}
// Pond
pd[0].pt[0].x =-15; pd[0].pt[0].y =5; pd[0].pt[0].z =0;
pd[0].pt[1].x =-5; pd[0].pt[1].y =7; pd[0].pt[1].z =0;
pd[0].pt[2].x =0; pd[0].pt[2].y =15; pd[0].pt[2].z =0;
pd[0].pt[3].x =-12; pd[0].pt[3].y =15; pd[0].pt[3].z =0;
pd[0].type = 31;
pd[1].pt[0].x =-12; pd[1].pt[0].y =15; pd[1].pt[0].z =0;
pd[1].pt[1].x =0; pd[1].pt[1].y =15; pd[1].pt[1].z =0;
pd[1].pt[2].x =2; pd[1].pt[2].y =22; pd[1].pt[2].z =0;
pd[1].pt[3].x =-3; pd[1].pt[3].y =25; pd[1].pt[3].z =0;
pd[1].type = 31;
pd[2].pt[0].x =25; pd[2].pt[0].y =5; pd[2].pt[0].z =0;
pd[2].pt[1].x =30; pd[2].pt[1].y =13; pd[2].pt[1].z =0;
pd[2].pt[2].x =25; pd[2].pt[2].y =20; pd[2].pt[2].z =0;
pd[2].pt[3].x =17; pd[2].pt[3].y =17; pd[2].pt[3].z =0;
pd[2].type = 31;
// Gate
gt[0].pt[0].x =0; gt[0].pt[0].y =-10; gt[0].pt[0].z =0;
gt[0].pt[1].x =0; gt[0].pt[1].y =-11; gt[0].pt[1].z =0;
gt[0].pt[2].x =0; gt[0].pt[2].y =-11; gt[0].pt[2].z =8;
gt[0].pt[3].x =0; gt[0].pt[3].y =-10; gt[0].pt[3].z =8;
gt[0].type = 31;
gt[1].pt[0].x =0; gt[1].pt[0].y =10; gt[1].pt[0].z =0;
gt[1].pt[1].x =0; gt[1].pt[1].y =11; gt[1].pt[1].z =0;
gt[1].pt[2].x =0; gt[1].pt[2].y =11; gt[1].pt[2].z =8;
gt[1].pt[3].x =0; gt[1].pt[3].y =10; gt[1].pt[3].z =8;
gt[1].type = 31;
gt[2].pt[0].x =0; gt[2].pt[0].y =-11; gt[2].pt[0].z =8;
gt[2].pt[1].x =0; gt[2].pt[1].y =-11; gt[2].pt[1].z =10;
gt[2].pt[2].x =0; gt[2].pt[2].y =11; gt[2].pt[2].z =10;
gt[2].pt[3].x =0; gt[2].pt[3].y =11; gt[2].pt[3].z =8;
gt[2].type = 31;
// Check Point
cp[0].pt[0].x =0; cp[0].pt[0].y =-10; cp[0].pt[0].z =0;
cp[0].pt[1].x =0; cp[0].pt[1].y =-11; cp[0].pt[1].z =0;
cp[0].pt[2].x =0; cp[0].pt[2].y =-11; cp[0].pt[2].z =10;
cp[0].pt[3].x =0; cp[0].pt[3].y =-10; cp[0].pt[3].z =10;
cp[0].type = 31;
cp[1].pt[0].x =0; cp[1].pt[0].y =10; cp[1].pt[0].z =0;
cp[1].pt[1].x =0; cp[1].pt[1].y =11; cp[1].pt[1].z =0;
cp[1].pt[2].x =0; cp[1].pt[2].y =11; cp[1].pt[2].z =10;
cp[1].pt[3].x =0; cp[1].pt[3].y =10; cp[1].pt[3].z =10;
cp[1].type = 31;
// Curve ( Panel )
cvp[0].pt[0].x =0; cvp[0].pt[0].y =-10; cvp[0].pt[0].z =49;
cvp[0].pt[1].x =0; cvp[0].pt[1].y =0; cvp[0].pt[1].z =42;
cvp[0].pt[2].x =0; cvp[0].pt[2].y =10; cvp[0].pt[2].z =42;
cvp[0].pt[3].x =0; cvp[0].pt[3].y =0; cvp[0].pt[3].z =49;
cvp[0].type = C32K(0,30,30);
cvp[1].pt[0].x =0; cvp[1].pt[0].y =-10; cvp[1].pt[0].z =35;
cvp[1].pt[1].x =0; cvp[1].pt[1].y =0; cvp[1].pt[1].z =42;
cvp[1].pt[2].x =0; cvp[1].pt[2].y =10; cvp[1].pt[2].z =42;
cvp[1].pt[3].x =0; cvp[1].pt[3].y =0; cvp[1].pt[3].z =35;
cvp[1].type = C32K(0,30,30);
cvp[3].pt[0].x =0; cvp[3].pt[0].y =0; cvp[3].pt[0].z =19;
cvp[3].pt[1].x =0; cvp[3].pt[1].y =10; cvp[3].pt[1].z =19;
cvp[3].pt[2].x =0; cvp[3].pt[2].y =10; cvp[3].pt[2].z =12;
cvp[3].pt[3].x =0; cvp[3].pt[3].y =0; cvp[3].pt[3].z =19;
cvp[3].type = 0;
cvp[4].pt[0].x =0; cvp[4].pt[0].y =0; cvp[4].pt[0].z =5;
cvp[4].pt[1].x =0; cvp[4].pt[1].y =10; cvp[4].pt[1].z =5;
cvp[4].pt[2].x =0; cvp[4].pt[2].y =10; cvp[4].pt[2].z =12;
cvp[4].pt[3].x =0; cvp[4].pt[3].y =0; cvp[4].pt[3].z =5;
cvp[4].type = 0;
cvp[2].pt[0].x =0; cvp[2].pt[0].y =-10; cvp[2].pt[0].z =19;
cvp[2].pt[1].x =0; cvp[2].pt[1].y =0; cvp[2].pt[1].z =12;
cvp[2].pt[2].x =0; cvp[2].pt[2].y =-10; cvp[2].pt[2].z =5;
cvp[2].pt[3].x =0; cvp[2].pt[3].y =-10; cvp[2].pt[3].z =5;
cvp[2].type = 0;
}
void setStandLf( short r, short h, short l, short sz )
{
short sx,sy;
sx = cx+r*sin(cang);
sy = cy-r*cos(cang);
putPoly( stand, 12, sx,sy,sz, cang, l/4, h/2, h/3, 1);
}
void setStandRt( short r, short h, short l )
{
short sx,sy;
sx = cx-r*sin(cang);
sy = cy+r*cos(cang);
putPoly( stand, 12, sx,sy,cz, cang, l/4, -h/2, h/3, 1);
}
int putChkPt()
{
putPoly( cp, 2,cx,cy,cz,cang, 1, (_max(cwr,cwl)+9)/10, 5, C32K(0,1,1));
return crd;
}
main()
{
puts("start:");
setPolData();
int i;
double ang,mang;
pn = 0;
putPoly( mt, 4, 13060,5700,0, 0.0, 300,300,200, C32K(0,0,1) );
// putPoly( mt, 4, 2000, 14000, 0, 0, 50, 50, 80, C32K(1,0,1) );
// putPoly( mt, 4, 21000, 6000, 0, 0, 50, 50, 80, C32K(1,0,1) );
// putPoly( pd, 3, 16000, 5000, 0, 0, 100,100,1, 1);
crd = 0;
cx = 15000;
cy = 5000;
cz = 400+1450;
cwl = 100;
cwr = 100;
cbank = 0;
cang = mang = 0; // x方向
setR(STEP);
setStandLf( 250, 150, 2000, cz-400 );
putPoly( gt, 3, 15000,5000,cz, cang, 120/10, 120/10, 10, C32K(1,1,1) );
goStr(5433,-1300+1450); // Grand stand
chk[0]=putChkPt();
cwr = 80;
cwl = 80;
mang = 55 *pi/180; // 1st Corner
curveRt(1000,mang,-1450+1450,30);
goStr(960,-1450+1450);
mang += 135 *pi/180; // 2nd Corner +190゚
curveRt(600,mang,-1300+1450,0);
goStr(1581,-1000+1450);
mang -= 60 *pi/180; // S-curve +130゚
curveLf(700,mang,-850+1450,0);
goStr(293,-800+1450);
mang += 70 *pi/180; // +200
curveRt(700,mang,-400+1450,0);
goStr(630,-50+1450);
mang = 130 *pi/180;
curveLf(800,mang,350+1450,0);
goStr(492,450+1450);
mang = 240 *pi/180;
curveRt(700,mang,500+1450,0);
goStr(960,800+1450);
mang = 160 *pi/180;
curveLf(1000,mang,1500+1450,0);
goStr(234,1550+1450);
mang = 125 *pi/180;
curveLf(1800,mang,1750+1450,0);
mang = 85 *pi/180;
curveLf(1800,mang,1700+1450,0);
goStr(1935,1550+1450); // Degner Curve
mang = 130 *pi/180;
curveRt(150,mang,1530+1450,0);
goStr(1238,1450+1450);
mang = 200 *pi/180;
curveRt(250,mang,1430+1450,0);
goStr(800,1250+1450);
goStr(400,1250+1450); // UnderPass
goStr(2671-1200,1500+1450);
mang = 250 *pi/180;
curveRt(1100,mang,1700+1450,0);
goStr(400,1870+1450);
chk[1]=putChkPt();
cwr = 140;
cwl = 60;
goStr(300,2000+1450);
step = 50;
mang = 165 *pi/180; // HairpinCurve
curveLf(200,mang,2100+1450,50);
mang = 80 *pi/180; // HairpinCurve
curveLf(200,mang,2200+1450,0);
step = STEP;
goStr(200,2250+1450);
cwl = 80;
cwr = 80;
goStr(1036,2450+1450);
mang = 100 *pi/180;
curveRt(2000,mang,2550+1450,0);
mang = 120 *pi/180;
curveRt(2000,mang,2550+1450,0);
mang = 150 *pi/180;
curveRt(2000,mang,2350+1450,0);
goStr(700,2250+1450);
goStr(350,2250+1450); //970
mang = 190 *pi/180;
curveRt(2500,mang,2450+1450,0);
goStr(700,2550+1450);
goStr(200,2550+1450);
goStr(900,2350+1450);
chk[2]=putChkPt();
mang = 120 *pi/180;
curveLf(600,mang,2450+1450,0);
goStr(700,2550+1450);
mang = 25 *pi/180;
curveLf(600,mang,2500+1450,0);
mang = -5 *pi/180;
curveLf(1000,mang,2450+1450,0);
mang = -18 *pi/180;
curveLf(2000,mang,2400+1450,0);
goStr(1170,1650+1450); // ?
mang = -24 *pi/180;
curveLf(10000,mang,1000+1450,0);
mang = -30 *pi/180;
curveLf(10000,mang,1250+1450,0);
// setStandRt( 250, 100, 3000, cz+100 );
goStr(5880,1600+1450);
chk[3]=putChkPt();
mang = -85 *pi/180;
curveLf(1300,mang,1570+1450,0);
goStr(2400,1800+1450);
goStr(121,1800+1450);
mang = 0 *pi/180;
curveRt(2500,mang,500+1450,0);
cwr = 100;
cwl = 100;
goStr(1161,400+1450);
printf("pols : %dx3\n",crd);
printf("start: %d,%d end:%d,%d\n",road[0].x,road[0].y,
road[crd].x,road[crd].y);
for(i=0; chk[i]!=0; ++i)
printf("ChkPoint%d:%d\n",i,chk[i]);
chks = 4;
exTime[0] = 25;
exTime[1] = 15;
exTime[2] = 20;
exTime[3] = 20;
makeRdat();
polmax = pn;
save_texdat(road[0].x-600,road[0].y,0);
initGrp();
putlmap();
getchar();
return 0;
}